import os

from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template

from ixapi import SimpleListDB

class MainHandler(webapp.RequestHandler):

  def get(self):
    self.response.out.write('ApiList')
    

class MainHandler(webapp.RequestHandler):

  def get(self):
    self.response.out.write('ApiList')
    
class SimpleList(webapp.RequestHandler):

  def get(self):
    listDb = SimpleListDB.all().order('-created')
    view_list = os.path.join(os.path.dirname(__file__), 'view/api/SimpleList.xml')
    view_list_values = {
      'lists': listDb,
      }
    self.response.headers['Content-Type'] = "application/xml"
    self.response.out.write(template.render(view_list, view_list_values))

def main():
  application = webapp.WSGIApplication([('/a', MainHandler),
                                        ('/a/', MainHandler),
                                        ('/a/simplelist', SimpleList)
                                        ],
                                       debug=True)
  util.run_wsgi_app(application)

if __name__ == '__main__':
  main()
